## load Rueda's dataset
rueda=read.csv("Duplication dataset.csv")
attach(rueda)
## change name of minimum wage variable (since min is a function in R)
minwag = rueda$min

library("lmtest")
library("plm")

## ACF plots ##

par(mfrow=c(2,3))

dvemp2 <- plm(govem~govpart+hkcorp+govpart:hkcorp+open+finop+dccggx+unemp+gdpgr+deca70+deca80+deca85+deca90,data=rueda,model="within")
acf(resid(dvemp2),main="Partisanship -> Public Sector")

dvwelf2 = plm(generos~govpart+hkcorp+govpart:hkcorp+open+finop+dccggx+unemp+gdpgr+deca70+deca80+deca85+deca90,data=rueda,model="within")
acf(resid(dvwelf2),main="Partisanship -> Gov Employment")

dvmin2 = plm(minwag~govpart+hkcorp+govpart:hkcorp+open+finop+dccggx+unemp+gdpgr+deca70+deca80+deca85+deca90,data=rueda,model="within")
acf(resid(dvmin2) ,main="Partisanship -> Minimum Wage")


ivemp2 = plm(ia5010~govem+generos+minwag+hkcorp+govem:hkcorp+unemp+ldc+femla+priv+deca70+deca80+deca85+deca90,data=rueda,model="within")
acf(resid(ivemp2),main="Public Sector -> Inequality")

ivwelf2 = plm(ia5010~govem+generos+minwag+hkcorp+generos:hkcorp+unemp+ldc+femla+priv+deca70+deca80+deca85+deca90,data=rueda,model="within")
acf(resid(ivwelf2),main="Welfare Generosity -> Inequality")

ivmin2 = plm(ia5010~govem+generos+minwag+hkcorp+minwag:hkcorp+unemp+ldc+femla+priv+deca70+deca80+deca85+deca90,data=rueda)
acf(resid(ivmin2),main="Minimum Wage -> Inequality")


